package com.example.demo.dao;

import com.example.demo.pojo.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;


/** 持久层
 * @author zhouzhenyuan
 */

public interface UserDao extends JpaRepository<User,String> {
    /**
     *
     * @param email 邮箱
     * @param userId 用户ID
     * @return
     */
    @Transactional
    @Modifying
    @Query("UPDATE user u SET u.email = ?1 WHERE u.userId = ?2")
    public int updateUserByUserId(String email,String userId);

}
